/*
 *  Copyright 2010 tarb.
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */

package com.googlecode.sbva.example.resourcebundle;

import com.googlecode.sbva.example.businessobjects.Address;
import com.googlecode.sbva.example.businessobjects.ObjectFactory;
import com.googlecode.sbva.example.businessobjects.Person;
import com.googlecode.sbva.example.businessobjects.SocialSecurityNumber;
import javax.validation.constraints.NotNull;

/**
 *
 * @author tarb
 */
public class DataFactory {

   public static Person createPopulatedPerson() {

      Person person = ObjectFactory.createPersonWithAddress();

      person.setFirstName("Fred");
      person.setMiddleName("T");
      person.setLastName("Smith");
      SocialSecurityNumber ssn = new SocialSecurityNumber();
      ssn.setArea("250");
      ssn.setGroup("34");
      ssn.setSerial("3453");
      person.setSsn(ssn);

      Address address = person.getAddress();
      address.setAddress0("123 Mulberry St");
      address.setAddress1(null);
      address.setCity("Las Vegas");
      address.setState("NV");
      address.setZip("23423");

      return person;

   }

   public static GroupObject createGroupObjectWithOnlyGroupFirstFour() {

      GroupObject g = new GroupObject();

      g.setA("A");
      g.setB("B");
      g.setC("C");
      g.setD("D");

      return g;
   }

   public static GroupObject createGroupObjectWithOnlyGroupVowels() {

      GroupObject g = new GroupObject();

      g.setA("A");
      g.setE("E");

      return g;
   }

   public static GroupObject createGroupObjectWithOnlyDefaultAndGroupVowels() {

      GroupObject g = new GroupObject();

      g.setA("A");
      g.setE("E");
      g.setF("F");

      return g;
   }

   public interface GroupFirstFour {}
   public interface GroupVowels {}

   public static class GroupObject {

      @NotNull(groups={GroupFirstFour.class, GroupVowels.class})
      private String a;
      @NotNull(groups=GroupFirstFour.class)
      private String b;
      @NotNull(groups=GroupFirstFour.class)
      private String c;
      @NotNull(groups=GroupFirstFour.class)
      private String d;
      @NotNull(groups=GroupVowels.class)
      private String e;
      @NotNull
      private String f;

      public String getA() {
         return a;
      }

      public void setA(String a) {
         this.a = a;
      }

      public String getB() {
         return b;
      }

      public void setB(String b) {
         this.b = b;
      }

      public String getC() {
         return c;
      }

      public void setC(String c) {
         this.c = c;
      }

      public String getD() {
         return d;
      }

      public void setD(String d) {
         this.d = d;
      }

      public String getE() {
         return e;
      }

      public void setE(String e) {
         this.e = e;
      }

      public String getF() {
         return f;
      }

      public void setF(String f) {
         this.f = f;
      }
      
   }

}
